package com.yuhanginfo.modules.sys.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import com.yuhanginfo.common.service.CrudService;
import com.yuhanginfo.modules.sys.entity.AnnouncementGroup;
import com.yuhanginfo.modules.sys.dao.AnnouncementGroupDao;

/**
 * 公告分类Service
 * @author Y.j
 * @version 2017-09-13
 */
@Service
@Transactional(readOnly = true)
public class AnnouncementGroupService extends CrudService<AnnouncementGroupDao, AnnouncementGroup> {
	@Autowired
	private AnnouncementGroupDao announcementDao;
	

	
	public List<AnnouncementGroup> findAll() {
		return announcementDao.findAllList(new AnnouncementGroup());
	}
	

	
	@Transactional(readOnly = false)
	public void save(AnnouncementGroup announcementGroup) {
		super.save(announcementGroup);
	}
	
	@Transactional(readOnly = false)
	public void delete(AnnouncementGroup announcementGroup) {
		super.delete(announcementGroup);
	}
	
	/**
	 * 查询标题是否被引用
	 */
	
	public Boolean announcementGroupByAnnouncement(String announcementGroupId) {
		return announcementDao.announcementGroupByAnnouncement(announcementGroupId)>0;
	}
	
	/**
	 * 查询标题是否重复
	 */
	public Boolean getAnnouncementGroupByName(String title) {
		return announcementDao.getAnnouncementGroupByName(title)>0;
	}
	
}